/*  1:   */ package com.atomikos.icatch.imp.thread;
/*  2:   */ 
/*  3:   */ import com.atomikos.icatch.system.Configuration;
/*  4:   */ 
/*  5:   */ final class ThreadFactory
/*  6:   */ {
/*  7:40 */   static final ThreadFactory singleton = new ThreadFactory("Atomikos");
/*  8:   */   private final String name;
/*  9:   */   private int count;
/* 10:   */   private final ThreadGroup group;
/* 11:   */   
/* 12:   */   static ThreadFactory getInstance()
/* 13:   */   {
/* 14:44 */     return singleton;
/* 15:   */   }
/* 16:   */   
/* 17:   */   private ThreadFactory(String threadBaseName)
/* 18:   */   {
/* 19:53 */     SecurityManager sm = System.getSecurityManager();
/* 20:54 */     this.group = (sm != null ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup());
/* 21:55 */     this.name = threadBaseName;
/* 22:   */   }
/* 23:   */   
/* 24:   */   String getBaseName()
/* 25:   */   {
/* 26:60 */     return this.name;
/* 27:   */   }
/* 28:   */   
/* 29:   */   Thread newThread(Runnable r)
/* 30:   */   {
/* 31:65 */     String realName = this.name + ":" + incCount();
/* 32:66 */     if (Configuration.isDebugLoggingEnabled()) {
/* 33:66 */       Configuration.logDebug("ThreadFactory: creating new thread: " + realName);
/* 34:   */     }
/* 35:67 */     Thread thread = new Thread(this.group, r, realName);
/* 36:68 */     thread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
/* 37:69 */     thread.setDaemon(true);
/* 38:70 */     return thread;
/* 39:   */   }
/* 40:   */   
/* 41:   */   private synchronized int incCount()
/* 42:   */   {
/* 43:75 */     return this.count++;
/* 44:   */   }
/* 45:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.thread.ThreadFactory
 * JD-Core Version:    0.7.0.1
 */